package com.guoxue.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.guoxue.dao.IIOSDeviceDao;
import com.guoxue.domain.IOSDeviceVo;
@Repository
public class IOSDeviceDaoImpl extends BaseDaoImpl<IOSDeviceVo> implements IIOSDeviceDao{

	@Override
	public List<IOSDeviceVo> getIOSDeviceList() {
		return find("FROM IOSDeviceVo");
	}

	@Override
	public void saveIOSDevice(IOSDeviceVo iOSDeviceVo) {
		saveOrUpdate(iOSDeviceVo);
	}

	@Override
	public IOSDeviceVo getIOSDevice(Integer uid) {
		return get("FROM IOSDeviceVo i WHERE i.uid = ?", new Object[]{uid});
	}

	@Override
	public void delIOSDevice(Integer uid) {
		executeHql("DELETE FROM IOSDeviceVo i WHERE i.uid=?", new Object[] {uid});
	}

	@Override
	public List<IOSDeviceVo> getIOSDeviceList(int i) {
		return find("FROM IOSDeviceVo i where i.type = ?",new Object[]{i});
	}

	@Override
	public IOSDeviceVo getIOSDevice(int followed, int i) {
		return get("FROM IOSDeviceVo i WHERE i.uid = ? AND i.type = ?", new Object[]{followed,i});
	}

}
